//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public abstract class TextBullet : IOfficeXmlSerializable
    {
        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            ReadXmlCore(context);
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            WriteXmlCore(context);
        }

        #endregion

        internal static TextBullet ReadBullet(ReadContext c)
        {
            switch (c.ReaderLocalName)
            {
                case "buNone":
                    var nb = new TextNoBullet();
                    nb.ReadXmlCore(c);
                    return nb;
                case "buChar":
                    var t = new TextCharBullet();
                    t.ReadXmlCore(c);
                    return t;
                case "buAutoNum":
                    var tab = new TextAutonumberBullet();
                    tab.ReadXmlCore(c);
                    return tab;
                case "buBlip":
                    var tbb = new TextBlipBullet();
                    tbb.ReadXmlCore(c);
                    return tbb;
                default:
                    return null;
            }
        }

        internal abstract void ReadXmlCore(ReadContext context);

        internal abstract void WriteXmlCore(WriteContext context);
    }
}